#pragma once 
#include <codec.h>
#include <video_decoder.h>
#include <video_encoder.h>
#include <audio_decoder.h>
#include <audio_encoder.h>

class codec_factory
{
private:
    /* data */
    
private:
    codec_factory(/* args */);
    ~codec_factory();

public:
    static codec_factory& get_instance() {
        static codec_factory instance;
        return instance;
    }

    ICodec* create_codec(const char* codec_name,AVCodecParameters* codecpar,AVRational time_base) {
        std::string name = codec_name;
        if(name == "h264_vpe") {
            ICodec * p_decoder = new video_decoder(codec_name,codecpar,time_base);
            return p_decoder;
        }else if(name == "h264enc_vpe") {
            ICodec * p_encoder = new video_encoder(codec_name,codecpar,time_base);
            return p_encoder;
        }else if(name == "aac") {
            ICodec * p_audio_decoder = new audio_decoder(codec_name,codecpar);
            return p_audio_decoder;
        }else if(name == "enc_aac") {
            ICodec * p_audio_enc = new audio_encoder(codec_name,codecpar);
            return p_audio_enc;
        }
        return nullptr;
    }
};

codec_factory::codec_factory(/* args */)
{
}

codec_factory::~codec_factory()
{
}
